<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>产品列表</title>

<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resources/css/back/product.css">

</head>
<body>
	<h1>产品列表</h1>
	<br>
	<div class="btn_link col-md-2 col-sm-3">
	  <a class="btn btn-info glyphicon glyphicon-plus"  onclick="showRight('<%=request.getContextPath() %>/editproduct')"><span class="icon_text">添加产品</span></a>
	</div>
	<div class="input-group search col-md-10 col-sm-9">
		<input type="text"  placeholder="请输入关键词" id="searchproname">
		<button class="btn btn-info" id="searchpro">搜索&nbsp;&nbsp;<span class="glyphicon glyphicon-search"></span></button>
	</div>
	<br>
	<div class="table-responsive">
	<table class="table table-striped table-hover table-bordered ">
		<thead>
			<tr class="success">
				<td>产品ID</td>
				<td>产品名称</td>
				<td>产品描述</td>
				<td>产品价格</td>
				<td>产品满意度</td>
				<td>状态</td>
				<td>操作</td>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${pro_list }" var="pro" >
				<tr>
					<td>${pro.id }</td>
					<td>${pro.proName }</td>
					<td>${pro.proDescription }</td>
					<td>￥<span>${pro.proPrice }</span></td>
					<td><span>${pro.satisfaction }</span>%</td>
					<c:if test="${pro.status eq 1}">
						<td class="offsale">在售&nbsp;<button class="btn btn-warning" onclick="setSaleStatus(${pro.id },-1,this)">下架</button></td>
					</c:if>
					<c:if test="${pro.status eq -1}">
						<td class="onsale">已下架&nbsp;<button class="btn btn-warning" onclick="setSaleStatus(${pro.id },1,this)">上架</button></td>
					</c:if>
					<td><button class="btn btn-info" onclick="showRight('<%=request.getContextPath() %>/editproduct','${pro.id}')">编辑</button>&nbsp;<button class="btn btn-danger" onclick="deletePro('${pro.id}')">删除</button></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	</div>
	<span class="col-md-7 col-sm-4"></span>
		 <ul class="pager col-md-5 col-sm-8">
			 <li>共${page.pages }页，当前第${page.pageNum }页</li>
			 <li><a href="JavaScript:void()"  onclick="showRight('<%=request.getContextPath() %>/productlist','id','${page.firstPage}')">首页</a></li>
			 <li><a href="JavaScript:void()"  onclick="showRight('<%=request.getContextPath() %>/productlist','id','${page.prePage}')">上一页</a></li>
			 <li><a href="JavaScript:void()"  onclick="showRight('<%=request.getContextPath() %>/productlist','id','${page.nextPage}')">下一页</a></li>
			 <li><a href="JavaScript:void()"  onclick="showRight('<%=request.getContextPath() %>/productlist','id','${page.lastPage}')">尾页</a></li>
		 </ul>
		 
<script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/back/product.js"></script>
</body>
</html>